package com.jarvis.zeng.design.pattern.filter.demo;

import java.util.List;

public class AndCriteria implements Criteria {

    private Criteria criteria1;
    private Criteria criteria2;

    public AndCriteria(Criteria criteria1, Criteria criteria2){
        this.criteria1 = criteria1;
        this.criteria2 = criteria2;
    }

    public List<Person> meetCriteria(List<Person> personList) {
        List<Person> personList1 = criteria1.meetCriteria(personList);
        return criteria2.meetCriteria(personList1);
    }
}
